home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / pdprolog.arc / PROLOG.DOC < prev    next >
Encoding:
Text File  |  1987-06-21  |  84.4 KB  |  3,037 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.                    AUTOMATA DESIGN ASSOCIATES
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.              A.D.A PROLOG Documentation Version 1.95C
  30.           for the Educational and Public Domain Versions
  31.  
  32.                           June 21, 1987
  33.  
  34.       Copyright Robert Morein and Automata Design Associates
  35.  
  36.                          1570 Arran Way
  37.                        Dresher, Pa. 19025
  38.  
  39.                          (215)-646-4894
  40.  
  41.  
  42.  
  43.  
  44.    News                                       1
  45.    Copyright Notice                           2
  46.    Introduction                               3
  47.    Product Descriptions                       4
  48.    Upgrade Policy                             11
  49.    Technical Support                          11
  50.    Installation                               12
  51.    Running the Demonstration Programs         12
  52.    The Special Offer                          14
  53.    Writing Programs for PD and Ed PROLOG      15
  54.    Running the Interpreter                    16
  55.    A Reference of Note                        18
  56.    Memory Size Configuration                  19
  57.    The Built In Predicate Library             20
  58.    Description of the Modifications           22
  59.    Description of the New Predicates          26
  60.    Memory Metric Predicates                   29
  61.    IBM PC Video Display Predicates            30
  62.    The Interrupt Menu                         32
  63.    Conserving Memory Space                    34
  64.    Prolog Tutorial                            36
  65.    Reading List                               49
  66.  
  67.                     
  68.      
  69.                            News
  70.  
  71. A.D.A.  offers  the first Prolog with a Cyclic Structure  Unifier 
  72. for the IBM PC.
  73.  
  74.      If  you  have CGA graphics capability,  be sure to run  "The 
  75. Knight's Tour",  by Tim Elliot,  to be found in GAMES.ARC. It's a 
  76. graphic  representation  of a classic puzzle:  how  to  make  the 
  77. "knight"  piece  of chess,  which has a rather peculiar  movement 
  78. rule, visit all the squares of a chess board.
  79.  
  80.      Javier  Salazar  has contributed  a  wang  algorithm,  which 
  81. determines the correctness of predicate calculus formulae,  and a 
  82. logic tutor.
  83.  
  84.      Jim   Adams   of   Bendix  Aerospace   has   contributed   a 
  85. skolemizer  program  (look for the file "LOGIC.ARC".  This  nifty 
  86. thing takes statements written in the formalism of the  predicate 
  87. calculus  and  converts them to prolog Horn clauses.  You  should 
  88. refer to chapter 10 of Clocksin and Mellish for explanation.
  89.  
  90.  
  91.      Take a look at the chess endgame program in "games."
  92.  
  93.      Simon   Blackwell's   "PIE"  Truth  Maintenance  System   is 
  94. presented in revised, debugged, and enlarged form. This system is 
  95. found  in  the  directory  "expert"  and  augments  the  strictly 
  96. deductive  capabilities  of raw Prolog with additional  forms  of 
  97. reasoning.  PIE  has a syntax that resembles colloquial  English. 
  98. Wait till you see the backwards quote marks!
  99.  
  100.      The predicates "batch" and "nobatch" are introduced to allow 
  101. execution  of batch files without confusing messages and  prompts 
  102. appearing on the screen. I've put one in Simon's "KOPS" file.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.                         Copyright Notice
  123.  
  124.      The  public domain PD PROLOG system has been contributed  to 
  125. the  public domain for unrestricted use with one  exception:  the 
  126. object  code  may not be  disassembled  or  modified.  Electronic 
  127. bulletin  boards  and SIG groups are urged to aid in giving  this 
  128. software the widest possible distribution.
  129.  
  130.      This documentation may be reproduced freely,  but it may not 
  131. be  included in any other documentation without the permission of 
  132. the author.
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.                           Introduction
  178.  
  179. We  hope  that you'll get some fun out of this  PROLOG.  It  will 
  180. afford  you exposure to THE fifth generation language at the cost 
  181. only  of  some  intellectual  effort.  The  motive  is  perfectly 
  182. explicable:  We  want you to think of Automata Design  Associates 
  183. for  fifth  generation  software.  It also gives us a  nice  warm 
  184. feeling.
  185.  
  186. The  minimum  memory  requirement is 200 k of  transient  program 
  187. area,  plus  whatever  space is needed to execute  programs  from 
  188. within PROLOG.  DOS or MSDOS 2.0 are required.  The program  does 
  189. not  require  IBM PC compatibility to run,  although  the  screen 
  190. access routines do require compatibility.
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.              Products by Automata Design Associates
  233.  
  234.      Automata  Design  Associates  specializes  in  software  for 
  235. artificial  intelligence  and  robotic  applications.   A  PROLOG 
  236. language  system is available in various configurations.  A  LISP  
  237. interpreter will be introduced in March of 1985.
  238.  
  239.  
  240.  
  241. 1. LISP systems
  242.  
  243.      PD LISP
  244.  
  245. PD  LISP is a public domain Common LISP subset.  It comes with  a 
  246. 150 page instruction manual on disk, and is available from us for 
  247. $10.00.
  248.  
  249.      .UNX LISP
  250.  
  251. UNX LISP, written by Dave Morein, is a Common LISP subset. It has 
  252. nifty  things like SAVE/RESTORE,  which let you stop a job in the 
  253. middle,  save  it,  and start it up again,  and  tree  structured 
  254. lexical scoping. It is available from us for $69.95.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287. I.PROLOG Systems
  288.  
  289.      There  are  six versions of PROLOG available  from  Automata 
  290. Design Associates.  The systems run under the MSDOS or PCDOS. All 
  291. of them access all available memory up to 1 megabyte.
  292.  
  293. .Public Domain PROLOG
  294.  
  295. This  serves to further the general awareness of the public about 
  296. PROLOG.  It  also is an excellent adjunct to anyone learning  the 
  297. language.  Most  of  the core PROLOG described  by  Clocksin  and 
  298. Mellish  in  the book Programming In  PROLOG  is  implemented.  A 
  299. complete  IBM PC video screen support library is included in this 
  300. and  all other A.D.A.  prologs.  Trace predicates are  not.  This 
  301. version is available from us for $10.00 postage paid.
  302.  
  303.  
  304. .Educational PROLOG
  305.  
  306. At  extremely modest cost this affords an educational institution 
  307. or  individual  a  PROLOG  system  which  provides  the   maximum 
  308. available  programming  area  available  within  the  8086  small 
  309. programming model.  Tracing,  a debugging aid,  allows monitoring 
  310. a program as it runs.  User settable spy points selectively allow 
  311. this.  Exhaustive  tracing  is also  available.  I/O  redirection 
  312. gives some file ability.
  313.  
  314.      An  "exec"  function allows the execution of  a  program  or 
  315. editor  from  within  PROLOG,  thus  encouraging  an  interactive 
  316. environment.
  317.  
  318.      An  "interrupt"   menu is added,  permitting the control  of 
  319. tracing, toggling the printer, and screen printing.
  320.  
  321.      Definite clause grammar support is now included.
  322.      
  323.      The cost of Educational PROLOG is $29.95.
  324.  
  325.  
  326.  
  327. .FS PROLOG
  328.  
  329.      A  small  increment  in price adds full random  access  file 
  330. capability. Character and structure I/O are allowed.
  331.  
  332.      The  "asserta and "assertz" predicates are expanded and work 
  333. with a clause indexing ability.  One can assert clauses  anywhere 
  334. in the database under precise pattern matching control. 
  335.  
  336.      A tree structured lexical scoping system and floating  point 
  337. arithmetic are other enhancements.
  338.  
  339.      The cost of FSM PROLOG is $49.95
  340.  
  341.  
  342.  
  343. .VMI PROLOG -- Virtual Memory (Replaces type VMS)
  344.  
  345.  
  346.      At reasonable cost the addition of virtual memory gives  an 
  347. expansion of capabilities of an order of magnitude. 
  348.  
  349.      The  database on disk is treated transparently.  No  special 
  350. provisions  need  be  made  by the  user.  Virtual  and  resident 
  351. databases  may be mixed.  A unique updating algorithim  preserves 
  352. the format of the database as typed by the user while making only 
  353. those changes necessary to make it equivalent to the database  in 
  354. central memory.
  355.  
  356.      The cost of VMI PROLOG is $99.95
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397. .VML PROLOG Large model Virtual Memory System
  398.  
  399.      A.D.A.  PROLOG is a remarkable fifth generation developement 
  400. tool  for  the  implementation  of  intelligent  strategies   and 
  401. optimized  control.  It  is both the kernel for  applications  of 
  402. virtually  unlimited scope and a sophisticated developement  tool 
  403. that multiplies the productivity of the programmer many times. 
  404.  
  405.      Conventional  Prolog  is based on the first order  predicate 
  406. calculus.   VML   emulates  the  second  order   calculus,   with 
  407. unconstrained   manipulation   of   cyclic,    self   referential 
  408. structures.  The  cyclic unifier is selectable by a mode  switch, 
  409. with no loss of compatibility. 
  410.  
  411.      Perhaps  only  one  other Prolog system,  written  by  Alain 
  412. Colmareur,  permits manipulation of cyclic structures.  Permitted 
  413. by the second order predicate calculus, but not the first, cyclic 
  414. structures are self referential, or recursively defined.
  415.  
  416.      A conventional Prolog system typically crashes when a cyclic 
  417. structure  is  found,  because  such a structure  appears  to  be 
  418. infinite. But with our Cyclic Unifier, available in types VML and 
  419. VMA Prolog, cyclic structures can be handled with impunity.
  420.  
  421.      Many  structures in nature are cyclic,  and we suggest  that 
  422. many applications will appear to the user.  For example, consider 
  423. the  benzene ring,  which chemists refer to as a cyclic  aromatic 
  424. hydrocarbon:
  425.                                 
  426.  
  427.                          H             H        
  428.                           \          /          
  429.                             C ===== C           
  430.                           /           \         
  431.                          /             \        
  432.                   H --- C                C --- H
  433.                          \\            //       
  434.                           \\          //        
  435.                             C ----- C           
  436.                           /           \         
  437.                          H             H        
  438.                                     
  439.  
  440. This  might  be represented in Prolog by a  cyclic  structure  as 
  441. follows:
  442.                                     
  443.                                     
  444.        X = [ [[c,h]],[c,h],[[c,h]],[c,h],[[c,h]],[c,h]|X]
  445.  
  446. It  would  appear that groups and topological properties  can  be 
  447. succinctly described as cyclic structures.  A simple group can be 
  448. expressed as follows:
  449.  
  450.                          X = [a,b,c|X]. 
  451.  
  452. Then  the cyclic nature of the group can be observed  with 
  453. the goal "member( M, X )", which gives:
  454.  
  455.               a,b,c,a,b,c,a,b,c,....(ad infinitum)
  456.  
  457.      With  a  cost/performance ratio exceeding that of any  other 
  458. product  and  a  compatibility  insured  by  compliance  to   the 
  459. Edinburgh syntax, performance is enhanced by numerous extensions, 
  460. many of them invisible to the user.
  461.  
  462.      A quick overview of some of the features discloses:
  463.  
  464.      1)  This  system now incorporates a cyclic  structure 
  465.      unifier.  The  only  other Prolog system  capable  of 
  466.      unifying  cyclic structures is PrologII,  written  by 
  467.      the inventor of Prolog, Alain Colmerauer. 
  468.  
  469.      2)  Invisible  compilation  to  a  semantic  network 
  470.      preserves the flexibility of the interpreted mode and 
  471.      the speed of a compiler.
  472.  
  473.      The  programmer can compile and recompile any portion 
  474.      of a module at any time.  The edit/compile/test cycle 
  475.      is short and free of strain. An interface is provided 
  476.      to an editor of choice.
  477.  
  478.  
  479.      3) Floating point arithmetic with a full  complement 
  480.      of  input  and  output  methods,  transcendental  and 
  481.      conversion functions.
  482.  
  483.  
  484.      4)  Virtual  memory.  Module  size  and  number  are 
  485.      unrestricted,   with  a  total  capacity  of  several 
  486.      hundred megabytes.  Resident and virtual modules  may 
  487.      be co-resident. Compilation is incremental. The cache 
  488.      algorithim  is  sophisticated.  Changes made  in  the 
  489.      database can be updated to disk by a single command.
  490.  
  491.  
  492.      5) A powerful exec function and acceptance of  stream 
  493.      input make  integration into  applications practical.
  494.  
  495.  
  496.      6)  Global polymorphic variables  retain  information 
  497.      that  would  otherwise  require  the  "assertion"  of 
  498.      facts.
  499.  
  500.  
  501.      7)  A  quoted  variable class,  borrowed  from  LISP, 
  502.      permits  referencing variables as objects as well  as 
  503.      by value.
  504.  
  505.  
  506.  
  507.      8) Multidimensional arrays,  dynamically created  and 
  508.      destroyed,  efficiently  store numeric and nonnumeric 
  509.      structures. Arrays are ideal for representing spatial 
  510.      and ordinal relationships.
  511.      
  512.      9)  Debugging facilities let you see your program run 
  513.      without any additional generation steps.
  514.  
  515.  
  516.      10)  Totally   invisible  and   incremental   garbage 
  517.      collection.   There   is  NEVER  any  wait  for  this 
  518.      function.
  519.  
  520.  
  521.      11)  A  tree  structured,   dynamically  configurable 
  522.      lexical scoping system. The work of many  programmers 
  523.      can  be coupled together in the form of libraries and 
  524.      nested domains. 
  525.  
  526.      Each lexically scoped domain is a hidden space  which 
  527.      communicates  with the parent domain via exports  and 
  528.      imports. Domains can be linked together under program 
  529.      control to achieve any desired configuration.
  530.  
  531.  
  532.      12) The Grammar Rule Notation is an integral feature.
  533.  
  534.  
  535.      13) Keyword redefinition makes porting code easy.
  536.  
  537.  
  538. The  cost  of this system is $200 for the MSDOS version.
  539.  
  540.  
  541.  
  542. .VMA PROLOG Large model Virtual Memory System
  543.  
  544. This  system  has  additional forms of  virtual  memory.  It  was 
  545. intended  for  deep  reasoning  problems.  Contact  us  for  more 
  546. information.
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.                      Prolog Runtime Systems
  563.  
  564.  
  565.      The A.D.A.  Runtime Systems permit distribution of  debugged 
  566. code in source form without royalties.  A Runtime System provides 
  567. all  of  the facilities of the corresponding  Development  System 
  568. except for:
  569.  
  570.      1) Tracing.
  571.  
  572.      2)  The  console  command loop.  
  573.  
  574. A  Runtime  System is invoked from the DOS command line  with  an 
  575. argument specifying a stream file that replaces the console.  The 
  576. stream file is a UNIX* innovation that allows applications to  be 
  577. connected by "pipes", in a convenient, high level manner.
  578.  
  579.      All  the  other  development  facilities  remain  available, 
  580. including  multiple modules and virtual memory.  Since update  to 
  581. disk  is  included,  the ability of the system to  learn  is  not 
  582. impaired in any way.  Compare this to our competitors, whose hard 
  583. compiled  code results in fixed goals and inability to change the 
  584. distribution on a dynamic basis.
  585.  
  586.      Four versions are available.  Each is priced the same as the 
  587. corresponding development system,  and can be distributed without 
  588. royalty by the license holder with his applications:
  589.      
  590.      
  591.           FS  Runtime - $50.00
  592.                          
  593.           VMI Runtime - $100.00
  594.  
  595.           VML Runtime - $200.00
  596.  
  597.           VMA Runtime - $250.00
  598.  
  599.      The above systems are in stock for immediate delivery.
  600.  
  601.  
  602.      * trademark AT&T
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.                          Upgrade Policy
  618.  
  619.      Half the cost of any A.D.A. PROLOG system may be credited to 
  620. the purchase of a higher level version.      The full cost of VMS 
  621. prolog  may  be  applied to the purchase of VMI  or  VML  PROLOG. 
  622. Updates to a particular level product vary from $15.00 to $35.00.
  623.  
  624.  
  625.                       Technical Information
  626.  
  627.      Technical  information  may be obtained at  (215)  -  646- 
  628. 4894. This is available provided that you have read the  entire 
  629. documentation  supplied with this disk, and at least the  first 
  630. third of Programming In Prolog. We will politely inquiries from 
  631. people who just want to see the sample programs run.
  632.  
  633.      Perhaps we can answer the following questions in advance:
  634.  
  635.      There is no support for:  APPLE II, Atari, Commodore, or  
  636. CPM 80 .  Other machines from these manufactures may be supported 
  637. in the future.
  638.  
  639.      The  MSDOS  products are available on "5"  IBM  compatible 
  640. diskettes.
  641.  
  642.  
  643.                       To Place Your Order:
  644.  
  645.      You may place your order at the following number:
  646.  
  647.                 (215)-646-4894   - day and night.
  648.  
  649.  
  650.  
  651.                              Returns
  652.  
  653.      The  software may be returned within 30 days of purchase for 
  654. a full refund.  This applies whether or not the software has been 
  655. used.  We do ask that manuals, disks and packaging be returned in 
  656. excellent condition.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.                           Installation
  673.  
  674.      You will need an IBM PC compatible machine with a minimum of 
  675. 256  kbytes  of  memory.  ED PROLOG benefits from  all  available 
  676. memory up to the 1 megabyte INTEL limit.
  677.  
  678.      To  determine the amount of TPA your machine  has,  run  the 
  679. "chkdsk" program which is supplied with DOS. The last line reads:
  680.  
  681.                         XXXXXX bytes free
  682.  
  683. where XXXXXX is a six digit number.
  684.  
  685. If  this  number  is greater than 200000,  ED  PROLOG  will  have 
  686. reduced workspace.  If it's over 245000,  the amount of memory is 
  687. optimal. If this is not the case, there are two possibilities:
  688.  
  689. 1) The machine doesn't have enough memory.
  690.  
  691. 2)  Something  else is removing memory from TPA,  such as  a  co-
  692. resident  program,  a  ramdisk,  a large dos driver,  or a  large 
  693. number of file or disk buffers.
  694.  
  695. If  you're  short of memory,  make sure that no  other  programs, 
  696. ramdisks,  or drivers besides DOS are running in the machine. You 
  697. may find it helps to eliminate (by renaming) the config.sys  file 
  698. when you intend to run ED PROLOG.
  699.  
  700.               How to run the Demonstration Programs 
  701.                 without Knowing What You're Doing
  702.  
  703.      We strongly advise that you purchase the book Programming in 
  704. PROLOG by Clocksin and Mellish,  publisher Springer Verlag, 1981. 
  705. For  the  impatient we give some advice.  Type the  demonstration 
  706. program you wish to run.  There must be at least one entry  point 
  707. within  the  program.  
  708.  
  709. Note:  Please  understand that these are demonstrations programs. 
  710. Regarding  user  interface,  they are poorly  written.  You  will 
  711. probably have to read Clocksin and Mellish to appreciate that the 
  712. following examples of input are not equivalent: "yes." , "yes" .
  713.  
  714.      The program fragment "console" shows how you may improve the 
  715. console input routines of any of these programs.
  716.      
  717.  
  718. The Hematology Diagnosis Program - "hemat"
  719.  
  720.      Although  the  logical structure is not as sophisticated  as 
  721. that of "animals", it is interesting for several reasons:
  722.  
  723.      1)  The  program  evaluates numerical data to  arrive  at  a 
  724. diagnosis.
  725.  
  726.      2) Although inaccurate, it demonstrates that useful question 
  727. answering systems are not difficult to write in PROLOG.
  728.  
  729.      3)  There  are  some mistakes in  the  program,  which  only 
  730. slightly impede its usefulness. 
  731.  
  732.      This  program  uses  structure  input.  Terminate  all  your 
  733. answers with a period, as in "y.<CR>", or "no.<CR>".
  734. The starting point is "signs.<CR>".  PROLOG will prompt  you 
  735. for  signs  of  anemia.  The  program attempts  to  diagnose  two 
  736. varieties of a hemolytic anemia.
  737.      The program could use a good working over by a  hematologist 
  738. and we would be delighted to collaborate.
  739.  
  740.  
  741. Prime Number Generator - "sieve"
  742.  
  743.      This  program demonstrates that anything can be programed in 
  744. PROLOG if one tries hard enough.  Asking the  question   
  745.   "primes( 50, L ).<CR>" causes a list of prime numbers less than 
  746. 50  to be printed out.  "Sieve" is heavily recursive and  quickly 
  747. exhausts the stack space of the small model interpreters.
  748.  
  749.  
  750. Grrules
  751.  
  752.      This  is  an  example  of the use  of  the  definite  clause 
  753. grammer  notation.  PD  PROLOG does  not  have  this  translation 
  754. facility, but ED PROLOG and  all of our other versions do. It  is 
  755. possible  to  perform  the  translations  by  hand  if  you  have 
  756. thoroughly  read  C  & M. Then you would  have  the  pleasure  of 
  757. asking:
  758.  
  759.          ?-sentence( X, [every,man,loves,a,woman], [] ).
  760.  
  761. and  having the meaning elucidated as a statment in the predicate 
  762. calculus.
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.                        Special Offer  # 1
  783.  
  784.      For  some  inexplicable reason,  demonstration programs  are 
  785. hard to come by. We are too busy writing PROLOG fill this gap. We 
  786. will reward the contribution of "cute" sample programs.  Here are 
  787. the guidlines as of 9/3/86:
  788.  
  789. 1) We've got enough games, puzzles and geneology programs. 
  790. 2) We need:
  791.      a)  Alternate  forms  of reasoning,  such  as  probabalistic 
  792. (Bayesian, fuzzy logic) forward chaining, cover sets.
  793.  
  794.      b)  Programs which use the graphics.
  795.  
  796.      c)  
  797. 3) Expert systems.
  798.  
  799. You  must be certain that your contribution does not infringe  on 
  800. anyone's copyright.
  801.  
  802. The reward is the following: A copy of VMI virtual memory PROLOG. 
  803. There will be a charge of $20.00 to cover our costs. That way, we 
  804. won't go broke rewarding sample programs.
  805.  
  806. The  sample program will be published as an intact file  together 
  807. with whatever comments or advertisments the author may see fit to 
  808. include, on our distribution disks. 
  809.  
  810. Exceptional  contributions  may  merit a copy of type  VML  large 
  811. model virtual memory PROLOG which now incorporates a UNIX1  style 
  812. tree structured domain system.
  813.  
  814.  
  815.  
  816.                         Special Offer # 2
  817.  
  818.  
  819.      If  you are a hardware manufacturer and would like a  PROLOG 
  820. language  for your system,  the solution is simple.  Just send us 
  821. one  of  your machines!  Provided your system  implements  a  "C" 
  822. compiler, it will be ported in no time flat.
  823.  
  824.  
  825. ______
  826.      1. Trademark of AT & T.
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.                  Writing Programs For ED PROLOG
  838.  
  839.      You do not type in programs at the "?-" prompt.  There is no 
  840. built-in  editor.  The command "consult( user )" is accepted  but 
  841. does not cause PROLOG to enter an editing mode.  We feel that the 
  842. most universally acceptable editing method is for the user to use 
  843. a text editor of choice,  which can be invoked from within PROLOG 
  844. by the "exec" predicate.
  845.  
  846.      Use  Wordstar  or your customary editor to write a  program. 
  847. Then  run  PD  PROLOG and use the consult function  to  load  the 
  848. program.
  849.  
  850.      In  all  cases except PD PROLOG,  you can  run  your  editor 
  851. without leaving PROLOG by use of the "exec" predicate.
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.                      Running the Interpreter
  893.  
  894. COMMANDS: Give commands in lower case.
  895.  
  896. TO RUN:
  897.      Invoke PROLOG.EXE.  After the "?-" prompt appears,  you  may 
  898.      give Prolog goals to be executed,  followed by a period, and 
  899.      a carriage return.
  900.  
  901. TO ENTER A FACT:
  902.      Don't do it except with the "assert" predicates. This is the 
  903.      most  frequently misunderstood aspect of A.D.A.  Prolog.  If 
  904.      you want to enter a bunch of facts,  put them in a file  and 
  905.      "consult" them using the "consult" predicate.
  906.  
  907. TO ASK A QUESTION:
  908.      At the prompt, type "<expression>.<CR>", where 
  909.      <expression>  is  a  question as described by  Clocksin  and 
  910.      Mellish. Be sure to terminate the question with a period.
  911.      The question may be up to 500 characters long.
  912.  
  913. TO INPUT A STRUCTURE AT THE KEYBOARD:
  914.      The structure may be up to 500 characters in length. Be sure 
  915.      to terminate with a period.
  916.  
  917. TO ASK FOR ANOTHER SOLUTION:
  918.      If a solution has been provided, the PROLOG interpreter will 
  919.      ask  "More?  (Y/N):".  Only  if  a "y"  is  typed  will  the 
  920.      interpreter perform a search.
  921.  
  922. TO ABORT A SEARCH:
  923.      Simply   type   the  escape  key.   The   interpreter   will      
  924.      respond  with  "Interrrupted.",  and return to  the  command      
  925.      prompt.
  926.  
  927. TO LOAD DATABASE:
  928.      Type  "consult(<filename>).<CR>" The file name must have the 
  929.      extension  ".PRO".  It  is  not  necessary  to  include  the 
  930.      extension in the argument of consult. The file name as given 
  931.      must not be the same as a predicate name in the file or  any 
  932.      file which will be loaded.
  933.  
  934. TO TRACE:
  935.      When the system displays the prompt "?-", type "trace.<CR>".  
  936.      The display will likely move too rapidly for you to read. To 
  937.      stop the display,  type Control S.  To restart the  display, 
  938.      type  Control S.  To turn the trace      display  off,  type 
  939.      "notrace<CR>"  at  the  prompt  "?-".   The  interrupt  menu 
  940.      contains  additional  options,  such  as sending  all  trace 
  941.      output to a file, as well as display at the console.
  942.  
  943.  
  944.  
  945.  
  946.  
  947. TO INTERRUPT A PROGRAM:
  948.      See  the  section  entitled  "The  Interrupt  Menu"  for   a 
  949.      description  of the flexible options.  Basically,  one types 
  950.      ESC  to terminate a program,  while Control V or  Control  I 
  951.      interrupt a program. 
  952.  
  953. TO RECONSULT A FILE:
  954.      The   predicate  "recon"  is  identical  to  the   Edinburgh 
  955.      predicate "reconsult."
  956.  
  957. TO REMOVE A DATABASE:
  958.      Type "forget(<filename>).<CR>"
  959.  
  960. TO REMOVE ALL ASSERTIONS MADE BY PROGRAMS OR YOU:
  961.      Type "forget( user ).<CR>"
  962.  
  963. TO EXIT TO THE OPERATING SYSTEM:
  964.      Type "exitsys.<CR>"
  965.  
  966.      The system is totally interactive; any commands the operator 
  967. gives  are and must be valid program statements.  Statements must 
  968. terminate with a period.      All commands which take a file name 
  969. also  accept a path name.  Any name which is not a  valid  PROLOG 
  970. atom (refer to C & M) must be enclosed in single quotes. Thus one 
  971. could say
  972.  
  973.      consult( expert )
  974.  
  975. but one would need single quotes with
  976.  
  977.      consult( 'b:\samples\subtype\expert' ).
  978.  
  979.  
  980. To exit the system, type "exitsys.<CR>"
  981.  
  982. Atoms  may contain MSDOS pathnames if they are enclosed by single 
  983. quotes, ie.,  '\b:\samples\animal' .
  984.  
  985. You may consult more than one file at a time.  However, all names 
  986. are public and name conflicts must be avoided. The order in which 
  987. modules are loaded may,  in cases of poor program design,  affect 
  988. the behavior.
  989.  
  990.  
  991.  
  992.                      Command Line Arguments
  993.  
  994.      ED and PD PROLOG accept one command line argument,  which is 
  995. the name of a "stream" which replaces the console for input.  The 
  996. "stream"  in  MSDOS is a pipe or file which supplies input  until 
  997. end-of-file is reached. Control then reverts back to the console. 
  998. To avoid noisy parser error messages when end-of-file is reached, 
  999. the  last command in the file should be "see( user )." See  Simon 
  1000. Blackwell's PIE program for an example of this.
  1001.  
  1002.                        A Reference of Note
  1003.  
  1004.  
  1005.      With  minor  exceptions,  the syntax is a superset  of  that 
  1006. described  by  Clocksin and Mellish in the  book  Programming  in 
  1007. Prolog by W.F.  Clocksin and C.S.  Mellish, published by Springer 
  1008. Verlag in Berlin, Heidelberg, New York, and Tokyo. We shall refer 
  1009. to this book as "C & M".
  1010.  
  1011.        A  book  review section is included at the end  of  this 
  1012. documentation.
  1013.  
  1014.  
  1015.      There   are  very  few   syntactical   differences,   mostly 
  1016. unrecognized and/or minor.
  1017.      When  an operator is declared using the "op" statement,  the 
  1018. operator must be enclosed in single quotes in the "op"  statement 
  1019. itself,  if  it would not otherwise be a legal Edinburgh functor. 
  1020. Subsequently,  however,  the parser will recognize it for what it 
  1021. is,  except  in  the "unop" statement,  where it  must  again  be 
  1022. enclosed in single quotes.
  1023.  
  1024.      Variable numbers of functor paramaters are supported.
  1025.  
  1026.      A  goal  may be represented by a  variable,  which  is  less 
  1027. restrictive  than  the  C  &  M requirement  that  all  goals  be 
  1028. functors.  The  variable must be instantiated to a  functor  when 
  1029. that goal is pursued.
  1030.  
  1031.      Rules which appear inside other expressions must be enclosed 
  1032. in  parenthesis  if  the "," operator is to be  recognized  as  a 
  1033. logical connective.
  1034.  
  1035.      All  infix  operators described by C & M,  and user  defined 
  1036. infix,  prefix, and postfix operators with variable associativity 
  1037. and precedence are supported exactly as in C & M.
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.                     Memory Size Configuration
  1058.  
  1059.      Type  ED  can  access the full memory of  the  machine,  but 
  1060. previously required configuation by A.D.A.  The supplied  program 
  1061. "prconf.exe"  allows  the user to configure the amount of  memory 
  1062. used  by the PROLOG system.  The reason why this is important  is 
  1063. that  it is the vacant memory above the system which is  used  by 
  1064. the  "exec"  function  to load and execute  other  programs.  The 
  1065. amount of memory used is configured into the PROLOG.EXE file  and 
  1066. cannot be changed when PROLOG is actually running.
  1067.  
  1068.      The  configuration  is  carried  out  with  PRCONF.EXE   and 
  1069. PROLOG.EXE on the same disk. The user runs PRCONF and answers the 
  1070. sole question
  1071.  
  1072.     Enter the amount of workspace required in decimal Kbytes:
  1073.  
  1074. PRCONF  then modifies the PROLOG.EXE file and writes the  changes 
  1075. out  to  disk.  This may be done as many times  as  required  and 
  1076. experimentation   is  beneficial.   There  are  several   factors 
  1077. competing for memory and they must be balanced:
  1078.  
  1079.       1)  The  amount of workspace must be sufficient to run  the 
  1080.       prolog programs.  The total amount of memory used by PROLOG 
  1081.       given by the following formula:
  1082.  
  1083.           size of PROLOG.EXE 
  1084.          +size of workspace selected
  1085.          +size of space needed to "exec" other programs, if used
  1086.          +size of "COMMAND.COM" if "exec" is used
  1087.         ----------------------------------------
  1088.          = Total used by Prolog system.
  1089.  
  1090.       "Total"  must be less than the available transient  memory. 
  1091.       To get this,  run the "chkdsk" program,  supplied with DOS, 
  1092.       and read the last line of the printout.
  1093.  
  1094.  
  1095.       2)  There must be sufficient memory to "exec"  the  desired 
  1096.       programs.
  1097.  
  1098.       3)  Drivers  and auxiliary programs installed by  the  user 
  1099.       such   as  "sidekick"  or  "superkey"  take  memory  in   a 
  1100.       preemptive  fashion.   You  may  have  some  difficulty  in 
  1101.       determining  how much free memory there  really  is.  After 
  1102.       PRCONF  has  been  run,  load  PROLOG  and  note  that  the 
  1103.       copyright  notice displays the highest memory location used 
  1104.       by PROLOG. 
  1105.  
  1106. If the selected amount of workspace is greater than the memory of 
  1107. the  machine allows,  PROLOG simply acquires all available memory 
  1108. for  its  own  use.  This has only one bad  effect  - the  "exec" 
  1109. function won't function.
  1110.  
  1111.  
  1112.                  The Built In Predicate Library
  1113.  
  1114.                 Available Operators in PD and ED PROLOG
  1115.  
  1116.  
  1117. Column 1 gives the function symbol. 
  1118.  
  1119. Column 2 gives the precedence. The range of precedence is 1 to 255.
  1120. A zero in the precedence column indicates the symbol is parsed as 
  1121. a functor, and precedence is meaningless in this case.
  1122.  
  1123. Column 3 gives the associativity. 
  1124. A zero in the associativity column indicates the symbol is parsed
  1125. as a functor, and associativity is meaningless in this case.
  1126.  
  1127. Column 4 indicates which version the function is available in. 
  1128. Unless otherwise noted, the function is available in all versions.
  1129. Nonstandard predicates are indicated by "NS".
  1130.  
  1131.  
  1132. op/pred      precedence    associativity         availability
  1133.  
  1134. "!"             0             0
  1135. "|"             0             0
  1136. "="             40,           XFX                   
  1137. "=="            40,           XFX                   
  1138. "\\="           40,           XFX                   
  1139. "\\=="          40,           XFX       
  1140. "/"             21,           YFX       
  1141. "@="            40,           XFX       
  1142. ">="            40,           XFX       
  1143. "=<"            40,           XFX       
  1144. ">"             40,           XFX       
  1145. "<"             40,           XFX       
  1146. "-"             31,           YFX        
  1147. "*"             21,           YFX
  1148. "+"             31,           YFX
  1149. "=.."           40,           XFX
  1150. "-->"           255,          YFY       (not  in  PD PROLOG)
  1151. "?-"            255,          FY  
  1152.       
  1153.  
  1154.  
  1155. "arg"           0,            0,                                   
  1156. "asserta"       0,            0,                                   
  1157. "assertz"       0,            0,                                   
  1158. "atom"          0,            0,                                   
  1159. "atomic"        0,            0,                                   
  1160. "batch"         0,            0
  1161. "clause"        0,            0,                                   
  1162. "clearops"      0,            0,                                   
  1163. "cls"           0,            0,       NS
  1164. "concat"        0,            0,                                   
  1165. "consult"       8,            FX,                                  
  1166. "crtgmode"      0,            0,       NS
  1167. "crtset"        0,            0,       NS
  1168. "curset"        0,            0,       NS
  1169. "curwh"         0,            0,       NS
  1170. "debugging      0,            0,                                   
  1171. "dir"           0,            0,                                   
  1172. "display"       0,            0,                                   
  1173. "dotcolor"      0,            0,       NS
  1174. "drawchar"      0,            0,       NS
  1175. "drawdot"       0,            0,       NS
  1176. "drawline"      0,            0,       NS
  1177. "exec"          0,            0,                                   
  1178. "exitsys"       0,            0,       NS                          
  1179. "forget"        0,            0,       NS                          
  1180. "functor"       0,            0,                                   
  1181. "get0"          8,            FX,                                  
  1182. "integer"       0,            0,                                   
  1183. "is"            40,           XFX,                                 
  1184. "listing"       0,            0,                                   
  1185. "memleft"       0,            0,      NS
  1186. "mod"           11,           XFX,                                 
  1187. "name"          0,            0,                                   
  1188. "nl"            0,            0,                                   
  1189. "nodebug"       0,            0,       (not in PD PROLOG)
  1190. "nonvar"        0,            0,                                   
  1191. "nospy"         50,           FX,      (not in PD PROLOG)
  1192. "not"           60            FX                                   
  1193. "notrace"       0,            0,       (not in PD PROLOG)
  1194. "op"            0,            0,                                   
  1195. "popoff"        0,            0,       NS
  1196. "popoffd"       0,            0,       NS
  1197. "popon"         0,            0,       NS
  1198. "popond"        0,            0,       NS
  1199. "print"         0,            0,                                   
  1200. "prtscr"        0,            0,       NS
  1201. "put"           0,            0,                                   
  1202. "ratom"         0,            0,                                   
  1203. "read"          0,            0,                                   
  1204. "recon"         0,            0, (Note: this is "reconsult")
  1205. "repeat"        0,            0,                                   
  1206. "retract"       0,            0                                    
  1207. "rnum"          0,            0,                                   
  1208. "see"           0,            0,       
  1209. "seeing"        0,            0,       
  1210. "seen"          0,            0,       
  1211. "skip"          0,            0,       (not in PD PROLOG)
  1212. "spy"           50,           FX,      
  1213. "tab"           0,            0,                                   
  1214. "tell"          0,            0,       
  1215. "telling"       0,            0,       
  1216. "told"          0,            0,       
  1217. "trace"         0,            0,       (not in PD PROLOG)
  1218. "true"          0,            0,                                   
  1219. "unop"          0,            0,                                   
  1220. "var"           0,            0,                                   
  1221. "write"         0,            0,                                   
  1222.                 Description of the Modifications
  1223.      
  1224.  
  1225. I/O Redirection
  1226.  
  1227. I/O  redirection is a feature described by Clocksin and  Mellish. 
  1228. The predicates "see",  "seeing",  "seen",  "tell", "telling", and 
  1229. "told" are used to select the streams used for input and output. 
  1230.  
  1231.      The  predicates  "seen" and "told" require as arguments  the 
  1232. name of the stream that is to be closed.  This enables the system 
  1233. to  remember the indices of several streams and switch  back  and 
  1234. forth between them.
  1235.  
  1236.      The  predicate "batch",  when inserted at the beginning of a 
  1237. stream file, has the following properties:
  1238.  
  1239.      1)  The normal prompt,  "?-",  and advisory messages do  not 
  1240.      appear at the screen.
  1241.  
  1242.      2)  It is self cancelling if the input stream is  reassigned 
  1243.      to the console.
  1244.  
  1245.      3) It may also be cancelled by the predicate "batch".
  1246.  
  1247.  
  1248.  
  1249. call( <goal> )
  1250.  
  1251.      The  predicate as defined in C & M is obsolete.  The purpose 
  1252. was  to permit a goal search where the goal name was  a  variable 
  1253. instantiated  to  some functor name.  A.D.A.  permits writing  of 
  1254. goals with such names,  so the mediation of the "call" clause  is 
  1255. no longer necessary.
  1256.  
  1257.      The  "call"  predicate  may  be  trivially  implemented  for 
  1258. compatibility with the PROLOG definition
  1259.  
  1260.                          call( X ) :- X.
  1261.  
  1262.  
  1263.  
  1264. clause
  1265.  
  1266.      The  function  clause(  X,  Y ) has the  new  optional  form 
  1267. clause(  X,  Y,  I  ).  If the third variable is written,  it  is 
  1268. instantiated  to the current address of a clause in  memory.  The 
  1269. only  use of the result is with succeeding assertfa and  assertfz 
  1270. statements.
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277. debugging
  1278.  
  1279.      "Debugging"  prints a list of the current  spypoints.  After 
  1280. each name a sequence of numbers may appear, indicating the number 
  1281. of  arguments that is a condition of the trace.  The  word  "all" 
  1282. appears  if  the  number of arguments is not a condition  of  the 
  1283. trace.
  1284.  
  1285.  
  1286.  
  1287.  
  1288. op( <prec>, <assoc>, <functor> )
  1289.  
  1290.      Defines  the  user  definable  grammar  of  a  functor.  The 
  1291. definition conforms to that in C & M. We mention here a minor but 
  1292. important point.  If <functor> is not a valid PROLOG atom it must 
  1293. be   enclosed  in  single  quotes  when  declared  in  the   "op" 
  1294. declaration.  It  is  not necessary or legal to do this when  the 
  1295. functor is actually being used as an operator.  In version 1.6, a 
  1296. declared  or built-in operator can be used either as an  operator 
  1297. or as a functor. For example, 
  1298.  
  1299.                          +(2,3) = 2 + 3.
  1300.  
  1301. is a true statement.
  1302.  
  1303.      Declared  operators  are annotated in the directory  display 
  1304. with their precedence and associativity.
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332. Output predicates
  1333.  
  1334.    display
  1335.    write
  1336.    print
  1337.    put
  1338.  
  1339.      These  functions  have  been  modified  to  accept  multiple 
  1340. arguments in the form:
  1341.  
  1342.                print( <arg1>, <arg2>, <arg3>,... )
  1343.  
  1344. Thus, "put( a, b, c )" would result in the display of "abc".
  1345.      The  names  of  some  PROLOG atoms that may  occur  are  not 
  1346. accepted  by  the  PROLOG scanner  unless  surrounded  by  single 
  1347. quotes.  This only applies when such an atom is read in, not when 
  1348. it is internally generated. Nevertheless, this presents us with a 
  1349. problem:  We  would  like to be capable of writing  valid  PROLOG 
  1350. terms to a file. In some cases, it is necessary to add the single 
  1351. quotes.  In other cases,  such as human oriented output, they are 
  1352. an irritant. The modified definitions of the following predicates 
  1353. are an attempt at a solution:
  1354.  
  1355.      display
  1356.      Operator  precedence  is ignored,  all functors are  printed 
  1357.      prefix and single quotes are printed if needed or they  were 
  1358.      supplied if and when the atom was originally input.
  1359.  
  1360.      write
  1361.      Operator  precedence is taken into account and operators are 
  1362.      printed according to precedence.  Single quotes are  printed 
  1363.      under the same conditions as for "display."
  1364.  
  1365.      print
  1366.      Operator  precedence is taken into account and operators are 
  1367.      printed  according to precedence.  Single quotes  are  never 
  1368.      displayed.  This  is  a  human oriented form of  output  and 
  1369.      should  never  be used for writing of terms for  the  PROLOG 
  1370.      scanner.
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387. get0
  1388. read
  1389.  
  1390.      The  functions  "get0"  and "read"  have  been  extended  to 
  1391. support input from a stream other than the one currently selected 
  1392. by "see". To direct output to a file or other stream, an optional 
  1393. argument  is used.  For example,  "get0( char,  <file name> )" or 
  1394. "get0( char,  user )" would cause input to come from <file  name> 
  1395. or the console.  If the file has not already been opened,  "get0" 
  1396. will fail.
  1397.  
  1398.  
  1399.  
  1400.      Atoms enclosed by single quotest, eg. '\nthis is a new line' 
  1401. can contain the escape sequences
  1402.  
  1403.      '\n', '\r', '\t' and '\''.
  1404.  
  1405.      If these atoms are printed by "display" or "write" they  are 
  1406. printed  just  as they are.  If they are printed by  the  "print" 
  1407. clause they are translated as follows:
  1408.  
  1409. '\n'  results  in  the printing of a carriage return and  a  line 
  1410. feed.
  1411. '\r' results in the printing of a carriage return only.
  1412. '\t' results in the printing of a tab character.
  1413. '\'' allows the printing of a single quote within a quoted atom.
  1414.  
  1415.      The "portray" feature is not presently implemented.
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.                 Description of the New Predicates
  1443.  
  1444.  
  1445. batch, nobatch
  1446.  
  1447. This  predicate now makes it possible to avoid the appearance  of 
  1448. messages and prompts on the screen when input has been redirected 
  1449. to come from a file.
  1450.  
  1451. The  predicate  formerly had a different effect which  no  longer 
  1452. exists.
  1453.  
  1454. When  placed  at  the head of a stream file which is  "seen"  the 
  1455. system  prompt  is not repetetively displayed as  the  stream  is 
  1456. executed. Advisory messages are not displayed either.
  1457.  
  1458. The  command "batch" is self cancelling if control reverts to the 
  1459. console  at any time.  It may also be cancelled by  invoking  the 
  1460. predicate "nobatch."
  1461.  
  1462. A related change is that when the Prolog system is invoked with a 
  1463. command  line  argument for a stream,  the system prompt  is  not 
  1464. initially displayed.  So if the first command in the stream  file 
  1465. is  "batch.",  it is possible to use i/o redirection without  the 
  1466. appearance of any system messages except aor the signon message.
  1467.  
  1468.  
  1469.  
  1470. clearops
  1471.  
  1472.      Nullify  the  operator  status  of  every  operator  in  the 
  1473.      database.
  1474.  
  1475. concat( (<variable> | <functor>), <List> )
  1476.  
  1477.      A  list  of functors or operators is concatenated  into  one 
  1478. string,  which becomes the name of a new atom to which <variable> 
  1479. or <functor> must match or be instantiated.
  1480.  
  1481.  
  1482. dir( option )
  1483.  
  1484.      Provide  an  alphabetized listing to the console  of  atoms, 
  1485. constants,   or   open  files.   Without  options,   simply  type 
  1486. "dir.<CR>". Options are:
  1487.  
  1488.      dir( p ) - list clause names only.
  1489.      dir( c ) - list consulted files only.
  1490.  
  1491. Consulted files are prefixed by "S:".
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497. exec( arg1, arg2, ... argn )
  1498.  
  1499.      Execute  the program named as arg1,  provided that there  is 
  1500. sufficient  memory.  arg2 through argn must be functors which are 
  1501. supplied  as the command line argument,  separated by  one  space 
  1502. from  neighbors.  The  PCDOS or MSDOS  operating  system  program 
  1503. "COMMAND.COM"  must be reachable by the DOS search path,  because 
  1504. using "exec" invokes "COMMAND.COM", which is the DOS shell.
  1505.  
  1506.      You  can temporarily leave PROLOG and execute the DOS  shell 
  1507. with  the  invocation "exec( command )." The  DOS  prompt  should 
  1508. appear,  and  you can run programs bearing in mind that PROLOG is 
  1509. still  resident and occupying the bulk of memory.  To  return  to 
  1510. PROLOG, type "exit" at the DOS prompt.
  1511.  
  1512.      This  function  is restricted in the case of the type PD  to 
  1513. executing  a  program named "prologed",  which may be  an  editor 
  1514. supplied by you.
  1515.  
  1516.      This  function  will not work properly unless the system  is 
  1517. configured for memory.
  1518.  
  1519.  
  1520. exitsys
  1521.  
  1522.      Exit to the operating system.
  1523.  
  1524.  
  1525.  
  1526. forget( <file name> )
  1527.      Make  a database unavailable for use and reclaim the storage 
  1528. it occupied.
  1529.  
  1530.  
  1531.  
  1532. ratom( <arg>, <stream> )
  1533.      Read an atom from the input stream,  to which <arg>  matches 
  1534. or  is  instantiated.  <stream> is optional.  If <stream> is  not 
  1535. given, the input stream defaults to the standar input.
  1536.      Input is terminated by a CR or LF, which are not included in 
  1537. the stream.
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.                      Arithmetic Capabilities
  1553.  
  1554.      Integer  arithmetic is supported.  Numbers are 32 bit signed 
  1555. quantities. The following arithmetic operators are supported:
  1556.  
  1557.               "+", "-", "*", "/", <, <=, >, >=, mod.
  1558.  
  1559. Arithmetic operators must never be used as goals,  although  they 
  1560. may be part of structures. It is legal to write:
  1561.  
  1562.                             X = a + b
  1563.      
  1564. which  results in the instantiation of X to the struture (a + b). 
  1565. But the following is not legal:
  1566.  
  1567.                alpha( X, Y ) :- X + Y, beta( Y ).
  1568.  
  1569.  
  1570. Evaluation  of  an arithemtic expression is mediated by the  "is" 
  1571. and inequality predicates.  For instance,  the following would be 
  1572. correct:
  1573.  
  1574.                  alpha( X, Y, Z ) :- Z is X + Y.
  1575.  
  1576.                  beta( X, Y ) :- X + 2 < Y + 3.
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.                     Memory Metric Predicate
  1608.  
  1609.      The purpose of this predicate is to give the prolog system 
  1610. a  sense  of  how much memory remains so  that  expensive  search 
  1611. strategies  can  be  controlled.  It is not possible  to  exactly 
  1612. quantify how much memory remains.  At the lowest level, there are 
  1613. two  types of memory - the stack and the heap.  The stack expands 
  1614. down  from  high  memory,  while  the heap  tends  to  expand  at 
  1615. unpredictable intervals upwards.  If the stack and heap meet, the 
  1616. prolog  system  must abort the search and return to  the  prompt. 
  1617. Judicious  use  of  the  memory  metric  predicates  reduces  the 
  1618. probability of this happening.
  1619.  
  1620.      The  stack is easy to quantify because it expands  downwards 
  1621. in  a  predictable  way with recursion.  The symbol  space  is  a 
  1622. "heap".  For  those  interested,  the structure of  the  heap  is 
  1623. determined  by  the C compiler under which Prolog  was  compiled. 
  1624. There  is  a function internal to Prolog known as  the  allocator 
  1625. searches  the  heap for enough contiguous memory to create a  new 
  1626. symbol.  The  heap resembles a piece of Swiss cheese;  the  holes 
  1627. represent symbols and already allocated memory while the remained 
  1628. is  searched  by the allocator for a piece of  contiguous  memory 
  1629. large enough to satisfy a request.  If one cannot be  found,  the 
  1630. uppermost  bound of the heap is expanded upwards,  and that bound 
  1631. is  the  number  which we measure for an  estimate  of  remaining 
  1632. memory.
  1633.  
  1634.      The  sqace between the top of the heap,  and  the top of the 
  1635. stack,  which we call "gap",  serves as a rough guide to how much 
  1636. memory  remains.  The  demands  of the system  are  not  entirely 
  1637. predictable,  however.  For example, the creation of a new symbol 
  1638. larger  than "gap" would cause an abort.  The user must  use  the 
  1639. numbers  supplied  by  these  functions  as  a  heuristic  guide, 
  1640. tempered  by  experience,  to  minimize  the  possibility  of  an 
  1641. unexpected abort.
  1642.  
  1643. "Gap" is measured in 256 byte pages.
  1644.  
  1645. memleft( X )
  1646.  
  1647. If  the argument is an integer,  this is satisfied if the size of 
  1648. "gap" is greater than "X".
  1649.  
  1650. If the argument is a variable,  it is instantiated to the  amount 
  1651. of "gap" remaining.
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.                  IBM PC Video Display Predicates
  1663.  
  1664.  
  1665. A high level method is provided for drawing and displaying on the 
  1666. screen of IBM PC and compatible computers. 
  1667.  
  1668.  
  1669.  
  1670. cls
  1671.  
  1672. Clear  the screen and position the cursor at the upper left  hand 
  1673. corner.
  1674.  
  1675.  
  1676.  
  1677. crtgmode( X )
  1678.  
  1679. Matches  the  argument to the mode byte of the display  which  is 
  1680. defined as follows:
  1681.  
  1682.           mode           meaning
  1683.  
  1684.            0             40 x  25  BW (default)
  1685.            1             40 x  25  COLOR
  1686.            2             80 x  25  BW
  1687.            3             80 x  25  COLOR
  1688.            4            320 x 200  COLOR
  1689.            5            320 x 200  BW
  1690.            6            640 x 200  BW
  1691.            7             80 x  25  monochrome  display card
  1692.  
  1693.  
  1694.  
  1695. crtset( X )
  1696.  
  1697. This  sets the mode of the display.  The argument must be one  of 
  1698. the modes given above. 
  1699.  
  1700.  
  1701.  
  1702. curset <row>, <column>, <page> )
  1703.  
  1704. Sets the cursor to the given row, column, and page. The arguments 
  1705. must be integers.
  1706.  
  1707.  
  1708.  
  1709. curwh  <row>, <column> )
  1710.  
  1711. Reports the current position of the cursor.  The argument must be 
  1712. an integer or variable. The format is:
  1713.  
  1714.      1) page zero is assumed.
  1715.      2) The row is in the range 0 to 79, left to right.
  1716.      3) The column is in the range 0 to 24, bottom to top.
  1717. dotcolor( <row>, <column>, <color> )
  1718.  
  1719. The  argument  <color> is matched to the color of  the  specified 
  1720. dot. The monitor must be in graphics mode.
  1721.  
  1722.  
  1723.  
  1724. drawchar( <character>, <attribute> )
  1725.  
  1726. Put a character at the current cursor position with the specified 
  1727. attribute.  The  arguments  <character> and <attribute>  must  be 
  1728. integers.  Consult  the IBM technical reference manual  regarding 
  1729. attributes.
  1730.  
  1731.  
  1732.  
  1733. drawdot( <row>, <column>, <color> )
  1734.  
  1735. Put  a dot at the specified position.  The monitor must be in the 
  1736. graphics  mode.  The  arguments  must be  integer.  The  argument 
  1737. <color> is mapped to integers by default in the following manner:
  1738.  
  1739.  
  1740.  
  1741. drawline( <X1>, <Y1>, <X2>, <Y2>, <color> )
  1742.  
  1743. Draw a line on the between the coordinate pairs. The monitor must 
  1744. be in the graphics mode and the arguments are integer.
  1745.  
  1746.  
  1747.  
  1748. prtscr
  1749.  
  1750. Print  the  screen  as it currently appears.  Be  sure  that  the 
  1751. printer  is  on  line and ready before invoking  this  predicate, 
  1752. since otherwise, the system may lock up or abort.
  1753.  
  1754.  
  1755.  
  1756. The  integer argument <color> referred to in the above predicates 
  1757. is represented as follows:
  1758.  
  1759.      COLOR          PALETTE 0           PALETTE 1
  1760.      
  1761.        0            background          background
  1762.        1            green               cyan
  1763.        2            red                 magenta
  1764.        3            brown               white
  1765.  
  1766. To change the palette and the background,  see the IBM  Technical 
  1767. Reference Bios listings for more information.
  1768.  
  1769.  
  1770.  
  1771.  
  1772.                        The Interrupt Menu
  1773.  
  1774.                          (type ED only)
  1775.  
  1776.      This  menu  has been modified.  It was formerly  called  the 
  1777. ESCAPE   menu,  but  the  meaning  of the  ESCAPE  key  has  been 
  1778. redefined.  It  is  no  longer necessary to display the  menu  to 
  1779. perform  one of the menu functions.  This reduces the  amount  of 
  1780. display which is lost by scrolling off the screen.
  1781.  
  1782.      Version  1.9 offers the ability to attempt a goal  from  the 
  1783. interrupt menu, while not disturbing the ongoing computation.
  1784.  
  1785.      At any time while searching, printing, or accepting keyboard 
  1786. input,  you can break to this menu.  It is generally not possible 
  1787. to  do  this  during disk access,  since control  passes  to  the 
  1788. operating  system  at this time.  Two keys cause  this  break  to 
  1789. occur:
  1790.  
  1791.      ^V:  The menu is displayed and a command is accepted at the 
  1792.           prompt  "INTERRUPT>".  After  a command,  the  menu  is 
  1793.           redisplayed  until  the user selects  a  command  which 
  1794.           causes an exit. 
  1795.  
  1796.      ^I:  The menu is not displayed.  Command is accepted at the 
  1797.           prompt  "INTERRUPT>" until the user selects  a  command 
  1798.           which causes an exit.
  1799.  
  1800.      ESC: Typing this key  causes a  termination of  the  PROLOG      
  1801.           search  and  control returns to the user command  level      
  1802.           with a prompt of "?-".  Notice that previously, the ESC      
  1803.           key invoked this menu. 
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.      As the resulting menu indicates, the following functions are 
  1828. possible:
  1829.  
  1830.      A: Abort the search and return to the prompt.
  1831.  
  1832.      O  Open  a trace file.  The user is prompted for  the  file 
  1833.         name.  The file receives all trace output.  If a file is 
  1834.         already opened it is closed with all output preserved.
  1835.  
  1836.      C  Close the trace file if one is open.  Otherwise there is 
  1837.         no effect.
  1838.  
  1839.     ^C: Immediately  exit PROLOG without closing files.  This is 
  1840.         not advised.
  1841.  
  1842.     ^P: Typing <Control>P toggles the printer. If the printer is 
  1843.         on,  all  input  and output will also be  routed  to  the 
  1844.         printer.
  1845.  
  1846.      S: If  the machine in use is an IBM PC compatible  machine, 
  1847.         the  currently displayed screen will be printed.  If  the 
  1848.         machine  is  not an IBM PC compatible,  do not  use  this 
  1849.         function.
  1850.  
  1851.      T: If  trace  is in use,  most of the trace output  can  be 
  1852.         temporarily turned off by use of this function,  which is 
  1853.         a toggle.
  1854.  
  1855.      G: Satisfy a goal.  The system prompt will appear. Do not be         
  1856.         confused  into  thinking that the system has reverted  to 
  1857.         the  prompt.  After the user has entered the goal in  the 
  1858.         usual  manner,  satisfaction  of the goal is  immediately 
  1859.         attempted.  This need not affect the running  computation 
  1860.         in  any way,  although it is certainly possible to do so. 
  1861.         After  the  goal is attempted,  control  returns  to  the 
  1862.         INTERRUPT  menu.  The  purpose is to facilitate  detailed 
  1863.         analysis of a running system.
  1864.  
  1865.      R:  Entering  another  ESC causes a return to the  current 
  1866.         activity  (keyboard  input or search)  with  no  residual 
  1867.         effect from the interruption.
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.                      Conserving memory space
  1883.  
  1884.  
  1885.        Success popping is controlled by the predicates "popond",
  1886. "popoffd",  "popon",  and  "popoff".  Success popping is means of 
  1887. reclaiming  storage which is used on backtracking to  reconstruct 
  1888. how a particular goal was satisfied.  If it is obvious that there 
  1889. is no alternative solution to a goal this PROLOG system is  smart 
  1890. enough to reclaim that storage. 
  1891.  
  1892.      In  this system,  succees popping is an expensive operation. 
  1893. Therefore,  there  is a tradeoff of memory versus  time.  On  the 
  1894. other hand, discrete use of success popping can actually speed up 
  1895. a program by recreating structures in a more accessible form.
  1896.  
  1897.      The  definitions of the control predicates is given in  this 
  1898. manual  and  their use is totally  optional.  The  modulation  of 
  1899. success popping has no effect on program logic (read solution.)
  1900.      
  1901.      The  "cut"  can  save  substantial  time  and  computational 
  1902. overhead  as well as storage.  Although the execution of the  cut 
  1903. costs  time,  you can design your program to use cuts in critical 
  1904. places  to  avoid unnecessary backtracking.  Thus  the  execution 
  1905. speed of the program can actually increase. 
  1906.      
  1907.      Anyone  who  has  read Clocksin and  Mellish  is  aware,  of 
  1908. course, that the "cut" has a powerful logical impact which is not 
  1909. always desirable.
  1910.  
  1911.  
  1912. popoff
  1913.  
  1914. See the below definition.
  1915.  
  1916.  
  1917.  
  1918. popon
  1919.  
  1920. The  inference  engine  does complete success popping  for  goals 
  1921. which appear after "popon".  Consider this example: 
  1922.  
  1923.   goal :-  a, popon, b, c, popoff, d.
  1924.  
  1925. If  no alternative solutions exist for b,  then  success  popping 
  1926. will  reclaim storage by removing unnecessary records  describing 
  1927. how  "b"  was  satisfied.  If the Prolog system cannot  rule  out 
  1928. possible additional solutions,  success popping will never occur, 
  1929. regardless of your use of "popon". 
  1930.      Since goal "d" occurs after "popoff",  success popping  will 
  1931. never occur.
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937. popoffd
  1938.  
  1939. If  no  "popon" or "popoff" declarations occur in a  clause,  the 
  1940. default  action  is  determined by  "popoffd"  and  "popond".  If 
  1941. "popoffd" has been invoked,  the default is that success  popping 
  1942. will not occur.
  1943.  
  1944.  
  1945.  
  1946. popond
  1947.  
  1948. The inverse of "popoffd". Turns on default success popping.
  1949. printf( <stream>, <term1>,<term2>,... )
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.                          Prolog Tutorial
  1993.  
  1994.  
  1995.                           Introduction
  1996.  
  1997.  
  1998.  
  1999.  
  2000.      Probably  you  have heard of the language PROLOG within  the 
  2001. last year or so. You probably wondered the following things:
  2002.  
  2003. 1) What does the name stand for? Names of computer languages are 
  2004. almost always acronyms.
  2005.  
  2006. 2) What is it good for?
  2007.  
  2008. 3) Why now?
  2009.  
  2010. 4) Can I get a copy to play with?
  2011.  
  2012.      Congratulations! You obviously know the answer to the fourth 
  2013. question. We now respond to the other three.
  2014.      
  2015. 1)  The  name  stands for "programming in logic." This  we  shall 
  2016. elaborate on in depth later on.
  2017.  
  2018. 2) PROLOG is good for writing question answering systems.  It  is 
  2019. also   good   for  writing  programs  that  perform   complicated 
  2020. strategies  that  compute the best or worst way to  accomplish  a 
  2021. task, or avoid an undesirable result.
  2022.  
  2023. 3) PROLOG was virtually unknown in this country until researchers 
  2024. in  Japan announced that it was to be the core language  of  that 
  2025. country's fifth generation computer project.  This is the project 
  2026. with  which  Japan hopes to achieve a domainant position  in  the 
  2027. world information industry of the 1990's. 
  2028.  
  2029.      PROLOG  is  one of the most unusual computer languages  ever 
  2030. invented.  It  cannot be compared to  FORTRAN,  PASCAL,  "C",  or 
  2031. BASIC.  The facilities complement,  rather than replace those  of 
  2032. conventional  languages.  Although  it  has great  potential  for 
  2033. database  work,  it  has  nothing in  common  with  the  database 
  2034. languages used on microcomputers.
  2035.  
  2036.      Perhaps  the  best point to make is that while  conventional 
  2037. languages are prescriptive, PROLOG is descriptive. A statement in 
  2038. a conventional language might read:
  2039.  
  2040.      if( car_wheels = TRUE ) then
  2041.        begin
  2042.          (some sort of procedure)
  2043.          X = X + 1;
  2044.        end 
  2045.  
  2046.  
  2047. A statment in PROLOG could just be a statment of fact about  cars 
  2048. and wheels. There are many relationships that hold. For instance,
  2049.  
  2050.      has( car, wheels ).
  2051.  
  2052.      has( car, quant(wheels, four) ).
  2053.  
  2054.      round( wheels ).
  2055.  
  2056. Each  of  these statments is an independent fact  relating  cars, 
  2057. wheels,  and  the  characteristics of wheels.  Because  they  are 
  2058. independent, they can be put into a PROLOG program by programmers 
  2059. working separately. The man who is a specialist on car bodies can 
  2060. say  his thing,  the wheel specialist can have his say,  and  the 
  2061. participants can work with relative independence. And this brings 
  2062. to light a major advantage of PROLOG:
  2063.  
  2064.  
  2065.                      PARALLEL PROGRAMMING!!!
  2066.                     
  2067.  
  2068. With  conventional  programming languages projects can  still  be 
  2069. "chunked",  or  divided between programmers.  But efficiency on a 
  2070. team  project  drops  drastically below that  of  the  individual 
  2071. programmer  wrapped  up  in  his own trance.  As  the  number  of 
  2072. participants    grows   the   need   for   communication    grows 
  2073. geometrically. The time spent communicating can exceed that spent 
  2074. programming! 
  2075.      Although   PROLOG   does   not  eliminate   the   need   for 
  2076. task  coordination,  the problem is considerably  simplified.  It 
  2077. also provides the ability to answer questions in a "ready to  eat 
  2078. form."  Consider your favorite BASIC interpreter.  Based upon the 
  2079. statements about cars and wheels previously given,  could you ask 
  2080. it the following question?   
  2081.  
  2082.                
  2083.       has( car, X ), round( X ).
  2084.  
  2085.      Does  a  car  have anything which  is  round?  The  question 
  2086. instructs the PROLOG interpreter to consider all the objects that 
  2087. it  knows are possessed by a car and find those which are  round. 
  2088. Perhaps  you are beginning to guess that PROLOG has the abilities 
  2089. of a smart database searcher.  It can not only find the facts but 
  2090. selectively find them and interpret them.
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.      Consider the problem of a fault tree, as exemplified by this 
  2103. abbreviated one:
  2104.  
  2105.  
  2106.  
  2107. {Car won't start}
  2108.      | 
  2109.      | 
  2110. [Engine  turns  over](No) --> [Battery voltage](no)-\
  2111.         (Yes)                                       v
  2112.          |                                  {Check battery}
  2113.          |
  2114. [Smell gasoline](yes) --> {Try full throttle cranking}
  2115.          |                       (failure)
  2116. /--------/                           |
  2117.  
  2118.                     (details omitted)
  2119.  
  2120.  
  2121.  
  2122.      The fault tree is easily programmed in BASIC. Later we shall 
  2123. show  that  PROLOG supplies a superior replacement for the  fault 
  2124. tree.  Though the tree is capable of diagnosing only the  problem 
  2125. for  which  it was designed,  PROLOG dynamically  constructs  the 
  2126. appropriate  tree from facts and rules you have provided.  PROLOG 
  2127. is not limited to answering one specific question.  Given  enough 
  2128. information,  it  will attempt to find all deductive solutions to 
  2129. any problem.
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.                           PROLOG PRIMER
  2159.  
  2160. I.                       Rules and Facts     
  2161.  
  2162.  
  2163.  
  2164.      This  is  where you should start if you know  nothing  about 
  2165. PROLOG. Let us consider a simple statment in PROLOG, such as:
  2166.  
  2167. 1)   has( car, wheels ).
  2168.  
  2169. This  statement  is a "fact.  The word "has" in this statment  is 
  2170. known  either  as a functor or predicate.  It is a name  for  the 
  2171. relationship  within the parenthesis.  It implies that a car  has 
  2172. wheels.  But  the  order  of  the words  inside  the  bracket  is 
  2173. arbitrary and established by you. You could just as easily say:
  2174.  
  2175. 2)   has( wheels, car ).
  2176.  
  2177. and if you wrote this way consistently,  all would be  well.  The 
  2178. words  has,  wheels,  and car are all PROLOG atoms.  "Wheels" and 
  2179. "car" are constants. 
  2180.      
  2181. A   database   of  facts  can  illustrate  the   data   retrieval 
  2182. capabilities of PROLOG. For instance:
  2183.  
  2184. 3)   has( car, wheels ).
  2185.      has( car, frame ).
  2186.      has( car, windshield ).
  2187.      has( car, engine ).
  2188.  
  2189. You could then ask PROLOG the question:
  2190.  
  2191. 4)   has( car, Part ).
  2192.  
  2193. The  capital  "P" of Part means that Part is a  variable.  PROLOG 
  2194. will make Part equal to whatever constant is required to make the 
  2195. question match one of the facts in the database. Thus PROLOG will 
  2196. respond:
  2197.  
  2198.      Part = wheels.
  2199.      
  2200.      More?(Y/N):
  2201.  
  2202. If you type "y" the next answer will appear:
  2203.  
  2204.      Part = frame.
  2205.  
  2206.      More?(Y/N):
  2207.  
  2208. If you continue, PROLOG will produce the answers Part = windshield 
  2209. and Part = engine. Finally, you will see:
  2210.  
  2211.      More?(Y/N):y
  2212.  
  2213.      No.
  2214.  
  2215. indicating that PROLOG has exhausted the database.  Incidentally, 
  2216. when  a  variable is set equal to a constant or  other  variable, 
  2217. it is said to be instantiated to that object.
  2218.  
  2219.      Notice  that  PROLOG searches the database forwards  and  in 
  2220. this case,  from the beginning.  The forward search path is built 
  2221. into PROLOG and cannot be changed. An author of a program written 
  2222. in  a  prescriptive language is quite conscious of the  order  of 
  2223. execution  of  his program,  while in PROLOG it is  not  directly 
  2224. under his control.
  2225.      
  2226.      The other major element is the rule which is a fact which is 
  2227. conditionally true. In logic this is called a Horn clause: 
  2228.  
  2229.  
  2230. 5)   has( X, wheels ) :- iscar( X ).
  2231.  
  2232. The  fact iscar( car ) and the above rule are equivalent to
  2233.  
  2234. 6)   has( car, wheels).
  2235.  
  2236. The  symbol :- is the "rule sign." The expression on the left  of 
  2237. :-is the "head" and on the right is the body.  The variable X has 
  2238. scope  of the rule,  which means that it has meaning only  within 
  2239. the rule.  For instance,  we could have two rules in the database 
  2240. using identically named variables.
  2241.  
  2242.  
  2243. 7)   has( X,  transportation ) :- 
  2244.                    has( X,  car ), has( license, X ).
  2245.  
  2246. 8)   has( X, elephant ) :- istrainer( X ), hasjob( X ).
  2247.  
  2248. The  variables  X in the two expressions are completely  distinct 
  2249. and have nothing to do with each other.
  2250.  
  2251. The comma between has( X, car ) and has( license, X ) means "and" 
  2252. or logical conjuction.  The rule will not be true unless both the 
  2253. clauses has(X, car) and has( license, X ) are true.
  2254.  
  2255.  
  2256.      On the other hand if there is a rule
  2257.      
  2258. 9)   has( license, X ) :- passedexam( X ).
  2259.  
  2260. consider what PROLOG will do in response to the question:
  2261.  
  2262. 10)  has( harry, transportation ).
  2263.  
  2264. (Notice  that  harry has not been capitalized because we  do  not 
  2265. want  it  taken as a variable.  We could,  however,  say  'Harry' 
  2266. enclosed in single quotes.)
  2267.  
  2268.      It  will scan the database and use (7),  in which X will  be 
  2269. instantiated to harry. The rule generates two new questions:
  2270.  
  2271. 11)  has( harry, car ).
  2272.  
  2273. 12)  has( license, harry ).
  2274.  
  2275. Assuming  that  harry  has  a car,  the first clause  of  (7)  is 
  2276. satisfied and the database is scanned for a match to (12). PROLOG 
  2277. picks  up  rule (9) in which X is instantiated to harry  and  the 
  2278. question is now posed:
  2279.  
  2280. 13)  passedexam( harry ).
  2281.  
  2282.      If there is a fact:
  2283.  
  2284.      passedexam( harry ).
  2285.  
  2286. in  the database then all is well and harry  has  transportation. 
  2287. If there is not, then PROLOG will succinctly tell you:
  2288.  
  2289.      No.
  2290.  
  2291. But  suppose Harry has money and can hire a chauffer as any  good 
  2292. programmer  can.  That  could be made part of the program in  the 
  2293. following way.
  2294.  
  2295.      The rule which PROLOG tried to use was:
  2296.  
  2297. 14)  has( X,  transportation ) :- 
  2298.                    has( X,  car ), has( license, X ).
  2299.  
  2300. At any point following it there could be included another rule:
  2301.  
  2302. 15)  has( X, transportation ) :- has( X, money ).
  2303.  
  2304. or simply the bald fact:
  2305.  
  2306. 16)  has( harry, transportation ).
  2307.  
  2308.      These  additional  rules  or  facts would  be  used  in  two 
  2309. circumstances.  If at any point a rule does not yield a solution, 
  2310. PROLOG   will  scan  forward  from  that  rule  to  find  another 
  2311. applicable  one.  This process is known as "backtracking  search" 
  2312. and can be quite time consuming.
  2313.  
  2314.  
  2315. If  in response to the "More?" prompt you answer "y" PROLOG  will 
  2316. search  for an additional distinct solution.  It will attempt  to 
  2317. find an alternate rule or fact for the last rule or fact used. If 
  2318. that  fails,  it  will back up to the antecedent rule and try  to 
  2319. find  an alternate antecedent.  And it will continue to  back  up 
  2320. until  it  arrives at the question you asked,  at which point  it 
  2321. will say:
  2322.  
  2323.      No.
  2324.  
  2325. "Antecedent"  to a rule means that it gave rise to its' use.  For 
  2326. example,  (7)  is  the antecedent of (9) in the  context  of  the 
  2327. question (16).
  2328.  
  2329.  
  2330.  
  2331.  
  2332. II.                          Grammar
  2333.  
  2334.      It is a boring subject, but it must be discussed. All PROLOG 
  2335. statements are composed of valid terms, possibly a rule sign (":-
  2336. "),  commas representing conjunction ("and"), and a period at the 
  2337. very end.
  2338.      A term is a structure, constant, variable, or number.
  2339.  
  2340.      What is a structure? It is a kind of grouping:
  2341.  
  2342.      1) Structures consist of a functor, and a set of objects or
  2343.         structures in parenthesis.
  2344.  
  2345.      2)  Objects are constants,  variables,  numbers,  or  lists, 
  2346.         which we have not discussed yet.
  2347.  
  2348.      3)  A  constant or functor must be a string of  letters  and 
  2349.         numbers, beginning with a lower case letter, unless
  2350.         you  choose  to  enclose  it in single  quotes  (  'howdy 
  2351.         pardner'  ),  in  which  case you are  freed  from  these 
  2352.         restrictions.
  2353.      4) A  variable  must be a string of  letters  and  numbers 
  2354.         beginning with a capital letter.
  2355.      
  2356.      5) A  functor  may optionally have  arguments  enclosed  in 
  2357.         parenthesis , as in: hascar( X ) or hascar. 
  2358.  
  2359. An example:  "has( X, transportation )." is a structure.
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. III.                    Input / Output      
  2378.  
  2379.      You   now   know  enough  to  write  simple  databases   and 
  2380. interrogate   them  profitably.   But  before  we  examine   more 
  2381. sophisticated  examples,  it  will be necessary to add input  and 
  2382. output to the language. There are built in functions which appear 
  2383. as rules which are satisfied once. Thus the statment:
  2384.  
  2385.      write( 'Hello world.' ).
  2386.  
  2387. can be included on the right side of a rule:
  2388.  
  2389.  
  2390. greetings(  X ) :- ishuman( X ),  write( 'Hello world.' ).  You 
  2391. can  also write "write( X )" where X is some variable.  Note that 
  2392. 'Hello  world.' is not enclosed in double quotes.  Single quotes, 
  2393. which denote a constant, are required. Double quotes would denote 
  2394. a list, which is another thing entirely.
  2395.  
  2396. Provided  that  a match to "ishuman" can be  found,  the  builtin 
  2397. function  "write"  is  executed and the message  printed  to  the 
  2398. screen.
  2399.      The  builtin  read( X ) reads a "structure" that  you  input 
  2400. from the keyboard. More formally, we have
  2401.  
  2402.      read( <variable> or <constant> )
  2403.      write( <variable> or <constant> )
  2404.  
  2405. If you write read( Input ),  then the variable "keyboard" will be 
  2406. assigned to whatever is typed at the keyboard,  provided that the 
  2407. input  is a valid PROLOG structure.  The builtin "read" will fail 
  2408. if instead of Keyboard we wrote read( baloney ),  where "baloney" 
  2409. is a constant,  and the user at the keyboard did not type exactly 
  2410. "baloney." 
  2411.  
  2412. When you input a structure in response to a "read" statement,  be 
  2413. sure to end it with a period and an <ENTER>. 
  2414.  
  2415.      There  is  a convenient way of putting the cursor on  a  new 
  2416. line. This is the builtin "nl". For example:
  2417.  
  2418.      showme :- write( 'line 1' ), nl, write( 'line 2' ). 
  2419.  
  2420. would result in:
  2421.  
  2422.      line 1
  2423.      line 2
  2424.  
  2425.      There  is  also a primitive form of input/output for  single 
  2426. characters. It will be discussed later.
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432. IV.                   A Fault Tree Example
  2433.  
  2434.      Consider the "won't start" fault tree for an automobile:
  2435.  
  2436. {Car won't start}
  2437.      | 
  2438.      | 
  2439. [Engine  turns  over](No) --> [Battery voltage](no)-\
  2440.         (Yes)                                       v
  2441.          |                                  {Check battery}
  2442.          |
  2443. [Smell gasoline](yes) --> {Try full throttle cranking}
  2444.          |                       (failure)
  2445. /--------/                           |
  2446. |           /------------------------/ 
  2447. |           |                       
  2448. |           |
  2449. |  [Check for fuel line leaks](yes)-->{Replace fuel line}
  2450. |          (no)
  2451. |           |
  2452. |           |
  2453. |  [Check for defective carburator](yes)--\
  2454. |          (no)                           v
  2455. |                                {Repair carburator}
  2456. \----\
  2457.      |
  2458.      |
  2459. [Is spark present](no)-->[Do points open and close](no)-\
  2460.      |                             (yes)                v
  2461. /----/                               |          {Adjust points}
  2462. |           /------------------------/
  2463. |           |
  2464. |  [Pull distributor wire, observe spark](blue)--\
  2465. |        (orange)                                v
  2466. |           |                           {Check plug wires & cap}
  2467. |           |
  2468. |  [Measure voltage on coil primary](not 12V)--\
  2469. |         (12V)                                v
  2470. |           |              {Check wiring, ballast resistor}
  2471. |           |
  2472. |  [Check condenser with ohmmeter](conducts)--\
  2473. |    (no conduction)                          v
  2474. |           |                         {Replace condenser}
  2475. |           |
  2476. |  [Open and close points](voltage not 0 - 12)--\
  2477. |   (voltage swings 0 - 12)                     v
  2478. |           |                         {Fix primary circuit}
  2479. |           |
  2480. |  {Consider hidden fault, swap components]
  2481. |
  2482. |
  2483. \-------{Call a tow truck!!}
  2484.  
  2485.  
  2486.  
  2487.      A PROLOG program to  implement this is simple. Each statment 
  2488. represents  a  decision point fragment of the  tree.  The  PROLOG 
  2489. interpreter  dynamically  assembles  the tree as  it  attempts  a 
  2490. solution. 
  2491.  
  2492. 'car wont start' :- write( 'Is the battery voltage low?' ), 
  2493.                     affirm, nl,
  2494.                     write( 'Check battery' ).
  2495.  
  2496. 'car wont start' :- write( 'Smell gasoline?' ), 
  2497.                     affirm, nl,
  2498.                     'fuel system'.
  2499.  
  2500. 'fuel system'    :- write( 'Try full throttle cranking' ).
  2501.  
  2502. 'fuel system'    :- write( 'Are there fuel line leaks?' ),
  2503.                     affirm, nl,
  2504.                     write( 'Replace fuel line.' ).
  2505.  
  2506. 'fuel system'    :- write( 'Check carburator' ).
  2507.  
  2508. 'car wont start' :- write( 'Is spark present?' ),
  2509.                     not( affirm ), nl,
  2510.                     'no spark'.
  2511.  
  2512. 'no spark'       :- write( 'Do points open and close?' ),
  2513.                     not( affirm ), nl,
  2514.                     write( 'Adjust or replace points.' ).
  2515.  
  2516. 'no spark'       :- write( 'Is the spark off the coil good?' ),
  2517.                     affirm,
  2518.                     write( 'Check plug wires and cap.' ).
  2519.  
  2520. 'no spark'       :- write( 'What is the voltage on the primary
  2521.                      of the coil: ' ), 
  2522.                     read( Volts ), 
  2523.                     Volts < 10,
  2524.                     nl,
  2525.                     write('Check wiring and ballast resistor.').
  2526.  
  2527. 'no spark'       :- write( 'Does the capacitor leak?' ),
  2528.                     affirm,
  2529.                     write( 'Replace the capacitor.' ).
  2530.  
  2531. 'no spark'       :- not( 'primary circuit' ).
  2532.  
  2533. 'primary circuit' 
  2534.                  :- write( 'Open the  points.  Voltage  across 
  2535.                       coil?:'), nl,
  2536.                     read( Openvolts ), Openvolts < 1, 
  2537.                     write(  'Close the points.  Voltage  across 
  2538.                       coil?:'),
  2539.                     read( Closevolts ), Closevolts > 10, nl,
  2540.                     write( 'Primary circuit is OK.' ). 
  2541.  
  2542. 'no spark'       :- write( 'Consider a hidden fault. Swap
  2543.                       cap, rotor,points,capacitor.' ).
  2544.  
  2545.  
  2546. 'Car wont start' :- write( 'Get a tow truck!!' ).
  2547.  
  2548.  
  2549.                          --End program--
  2550.  
  2551.  
  2552.      The  above  is  a  simple example of  an  expert  system.  A 
  2553. sophisticated  system would tell you exactly the method by  which 
  2554. it  has reached a conclusion.  It would communicate by a  "shell" 
  2555. program  written  in PROLOG which would accept a wider  range  of 
  2556. input   than  the  "valid  structure"  required  by  the   PROLOG 
  2557. interpreter directly.
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597. V.                            Lists
  2598.  
  2599.      Consider  a  shopping list given you by your wife.  It is  a 
  2600. piece of paper with items written on it in an order that probably 
  2601. symbolizes  their  importance.  At the top it  may  say  EGGS!!!, 
  2602. followed by carrots, hamburger, and finally a flea collar for the 
  2603. dog, if you can find one. In PROLOG such a list would be written:
  2604.  
  2605. 1)   [eggs, carrots, hamburger, fleacollar]
  2606.  
  2607. The  order of a list is important so that eggs and carrots cannot 
  2608. be reversed and PROLOG be uncaring.
  2609.  
  2610. Let us put the list in a structure:
  2611.  
  2612.      shopping( [eggs, carrots, hamburger, fleacollar] ).
  2613.  
  2614. Then  if you wished to isolate the head of the list you could ask 
  2615. the question:
  2616.  
  2617.      shopping( [ Mostimportant | Rest ] ).
  2618.  
  2619. and PROLOG would respond:
  2620.  
  2621.      Mostimportant   =  eggs,   
  2622.      Rest   =   [carrots,   hamburger, fleacollar].
  2623.  
  2624. The vertical bar "|" is crucial here. It is the string extraction 
  2625. operator,  which  performs  a  combination  of the  CDR  and  CAR 
  2626. functions  of LISP.  When it appears in the context [X|Y] it  can 
  2627. separate the head of the list from the rest, or tail.
  2628.  
  2629.  
  2630.      You  may have gained the impression that PROLOG is a  rather 
  2631. static language capable of answering simple questions,  but it is 
  2632. far  more powerful than that.  The string extraction operator  is 
  2633. the  key.  It permits PROLOG to whittle a complex expression down 
  2634. to the bare remainder.  If the rules you have given it permit  it 
  2635. to  whittle  the  remainder  down to  nothing,  then  success  is 
  2636. achieved. An example of this is the definition of "append."
  2637.  
  2638.      Let  us suppose you have not yet done yesterday's  shopping, 
  2639. let alone today's. You pull it out of your wallet and sootch tape 
  2640. it to the list your wife just gave you. Yesterday's list was:
  2641.  
  2642.      [tomatoes, onions, ketchup]
  2643.  
  2644. Combined with [eggs, carrots, hamburger, fleacollar] we obtain
  2645.  
  2646.      [eggs,carrots,hamburger,fleacollar,tomatoes,onions,garlic].
  2647.  
  2648. To  take one list and to attach it to the tail of another list is 
  2649. to  "append"  the first to the second.  The PROLOG definition  of 
  2650. append is:
  2651.  
  2652.  
  2653.  
  2654. Rule1:     append( [], L, L ).
  2655.  
  2656. Rule2:     append( [X|List1], List2, [X|List3] ) :-
  2657.               append( List1, List2, List3 ].
  2658.  
  2659. The  general  scheme is this:  
  2660.  
  2661. The definition consists of one rule and one fact.  The rule  will 
  2662. be used over and over again until what little is left matches the 
  2663. fact.  The [] stands for empty list,  which is like a bag without 
  2664. anything in it. This is an example of a recursive definition.
  2665.      Suppose we ask:
  2666.  
  2667.      append( [a,b,c], [d,e,f], Whatgives ).
  2668.  
  2669. 1. Rule 2 is invoked with arguments ( [a,b,c], [d,e,f], Whatgives ).
  2670. 2. Rule 2 is invoked again with arguments:
  2671.      ( [b,c], [d,e,f], List3 ).
  2672. 3. Rule 2 is invoked again with arguments:
  2673.      ( [b], [d,e,f], List3 ).
  2674. 4.  The  arguments  are now ([],  [d,e,f],  List3 ).  Rule 1  now 
  2675.     matches. End.
  2676.  
  2677. How does this cause a list to be constructed? The key is to watch 
  2678. the   third  argument.   Supplied  by  the  user,   it  is  named 
  2679. "Whatgives". The inference engine matches it to [X|List3] in rule 
  2680. 2. Now lets trace this as rule two is successivly invoked: 
  2681.  
  2682.  
  2683.         Whatgives                                                
  2684.            |                                                     
  2685.            |                                                     
  2686.            |                                                     
  2687.            v                                                     
  2688. Rule2:  [X|List3] (List1 = [b,c])                                
  2689.          |  \                                                    
  2690.          |   \                                                   
  2691.          |    \                                                  
  2692.          v     \                                                 
  2693. Rule2:   a   [X'|List3'] (List1' = [c])                          
  2694.               |    \                                             
  2695.               |     \                                            
  2696.               |      \                                           
  2697.               v       \                                          
  2698. Rule2:        b     [X''|List3''] (List1'' = [], ie., empty set.)
  2699.                       |    \                                     
  2700.                       |     \                                    
  2701.                       |      \                                   
  2702. Rule1:                c       L  ( in Rule1 = [d,e,f] )              
  2703.                                                                  
  2704. End.
  2705.  
  2706.  
  2707. L in rule 1 is [d,e,f] for the following reason: Notice that rule 
  2708. 2 never alters List2. It supplies it to whatever rule it invokes. 
  2709. So L in rule 1 is the original List2, or [a,b,c].
  2710.  
  2711.      This example would not have worked if the order of rules one 
  2712. and  two  were  reversed.  The  PROLOG  inference  engine  always 
  2713. attempts to use the the first rule encountered. You could imagine 
  2714. it as always reading your program from the top down in attempting 
  2715. to  find an appropriate rule.  Since rule 2 would always satisfy, 
  2716. an  unpleasant  thing  would  have happened  if  the  order  were 
  2717. reversed. The program would loop forever.
  2718.  
  2719.                          A Reading List
  2720.  
  2721.      I  hope  that  this tiny introduction to PROLOG  whets  your 
  2722. appetite. But if you want to go on, there is no one book which  I 
  2723. could recommend as a complete reference. This is a reflection  on 
  2724. the depth of the subject. 
  2725.  
  2726.  
  2727. If  you  don't  consider yourself very  technical,  or  you're  a 
  2728. manager wishing to learn about Prolog, or you simply want as much 
  2729. assistance as possible, a good book is:
  2730.  
  2731.      Introduction to Prolog
  2732.      Bharath, Ramachandran
  2733.      TAB books, 1985
  2734.  
  2735. I  don't  recommend  it to those seriously interested,  or  as  a 
  2736. precursor to the more advanced texts.
  2737.  
  2738. The "standard text",  which throws piles of source code fragments 
  2739. at you is:
  2740.  
  2741.      Programming In Prolog
  2742.      W.F. Clocksin and C.S. Mellish
  2743.      Springer - Verlag
  2744.      Berlin,Heidelberg,New York. 1981,1984
  2745.  
  2746. It can be purchased directly from Springer Verlag in New York.
  2747.  
  2748. The  authors  apparently  believe  in the  Montessori  method  of 
  2749. instruction.  The importance of this book cannot  be  underrated, 
  2750. however,  when you consider that it established a standard,  core 
  2751. Prolog  dialect  simply by virtue of its publication.  The  first 
  2752. several  chapters  are eminently readable. When  you  get  bogged 
  2753. down, however, it might be time to switch. 
  2754.  
  2755. If  you  think that what you want  is  detailed  explanation,  we 
  2756. recommend:
  2757.  
  2758.      Prolog for Programmers
  2759.      Kluzniak, Feliks and Szpakowicz, Stanislaw
  2760.      APIC Studies in Data Processing No. 24
  2761.      Academic Press, 1985
  2762. This is a detailed text which rewards careful study. Most likely, 
  2763. you'll  decide you didn't want detailed explanation afterall.  It 
  2764. has  the  theoretical foundation for a university course  in  the 
  2765. subject.
  2766.  
  2767. Slightly  less  theoretical and very comprehensive is: 
  2768.  
  2769.      The  Art  of Prolog
  2770.      Sterling and Shapiro 
  2771.      MIT Press, 1986     
  2772.  
  2773.  
  2774. One  book presents interesting "AI" applications such  as  game 
  2775. playing,  strategy, and shell systems in  considerable  detail. 
  2776.  
  2777. You may be interested in seeing "AI" applications such as  game 
  2778. playing,  strategy, and shell programs in considerable  detail. 
  2779. The   following  book  has  alot  of  code  that   with   minor 
  2780. modification   can  be  made  to  work  (watch  the  range   of 
  2781. precedences for operators, which is 0 to 255 in C & M Prolog).
  2782.  
  2783.        Prolog Programming for Artificial Intelligence
  2784.        Ivan Bratko                               
  2785.        Addison-Wesley, 1986
  2786.        
  2787. Bratko's book can take one from the very fundamentals to rather 
  2788. advanced  data structures. However, as an introduction, it  may 
  2789. be too fast paced, requiring supplementation.
  2790.  
  2791.      If  one  purchased all of the books,  one would  undoubtedly 
  2792. find  reward  in switching from one to the  other,  as  the  need 
  2793. arose.
  2794.  
  2795. The  state  of  the art is well characterized  by  the  following 
  2796. texts:
  2797.  
  2798.      Logic Programming
  2799.      Edited by K.L. Clark and S.-A. Tarnlund
  2800.      Academic Press, 1982
  2801.  
  2802.      Academic papers describing shortfalls and extensions to  the 
  2803.      language. A potpourri.
  2804.  
  2805.  
  2806.      Logic Programming and Its Applications
  2807.      Edited by Michel Van Caneghem and David H. D. Warren
  2808.      Ablex, 1986
  2809.  
  2810.      Inspirational short-takes of state of the art applications.
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.      Implementations of Prolog
  2818.      Edited by J.A. Campbell
  2819.      Ellis Horwood, 1984
  2820.  
  2821.      Chronicles all the mistakes and successes of those trying to 
  2822.      produce  a  nice  implementation.  Leaves  out  the   Warren 
  2823.      machine, which is a pity, however, since it is the father of 
  2824.      all other compilation techniques. 
  2825.  
  2826. The above three texts are difficult, but ideal if you want to get 
  2827. into research.
  2828. A  purely  mathematical treatise, I recommend this text  for  the 
  2829. pure mathematician:
  2830.  
  2831.      Foundations of Logic Programming
  2832.      J.W. Lloyd
  2833.      Springer - Verlag 1984
  2834.  
  2835. It  is  a  proof-theoretic derivation of  the  automatic  theorem 
  2836. prover used by PROLOG.
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.                              Index
  2873.  
  2874. A Reference of Note, 18
  2875. Append, 47
  2876. Arithmetic Capabilities, 28
  2877.  
  2878. Batch, 22, 26
  2879.  
  2880. Call, 22
  2881. Chkdsk, 12
  2882. Clause, 22
  2883. Clearops, 26
  2884. Clocksin and Mellish, 12
  2885. Cls, 30
  2886. Co-resident program, 12
  2887. Command Line Arguments, 17
  2888. Concat, 26
  2889. Conserving memory space, 34
  2890. Crtgmode, 30
  2891. Crtset, 30
  2892. Curset, 30
  2893. Curwh, 30
  2894. Cut, 34
  2895. Cyclic Unifier, 7
  2896.  
  2897. Debugging, 23
  2898. Definite clause grammer, 13
  2899. Description of the Modifications, 22
  2900. Dir, 26
  2901. Disk buffers, 12
  2902. Display, 24
  2903. Dos driver, 12
  2904. Dotcolor, 31
  2905. Drawchar, 31
  2906. Drawdot, 31
  2907. Drawline, 31
  2908.  
  2909. Educational PROLOG, 5
  2910. Exec, 27
  2911. Exitsys, 27
  2912.  
  2913. Forget, 27
  2914. FS PROLOG, 5
  2915.  
  2916. Get0, 25
  2917. Grrules, 13
  2918.  
  2919. I/O Redirection, 22
  2920. IBM PC Video Display Predicates, 30
  2921. Input / Output, 43
  2922. Installation, 12
  2923.  
  2924. LISP
  2925.   PD LISP, UNX LISP, 4
  2926. Lists, 47
  2927. Megabyte INTEL limit, 12
  2928. Memleft( X ), 29
  2929. Memory Metric Predicate, 29
  2930. Memory Size Configuration, 19
  2931. Memory used by PROLOG, 19
  2932.  
  2933. Nested goals, 33
  2934. New Predicates, 26
  2935. Nobatch, 26
  2936.  
  2937. Op, 23
  2938. Output predicates, 24
  2939.  
  2940. Popoff, 34
  2941. Popoffd, 34, 35
  2942. Popon, 34
  2943. Popond, 34, 35
  2944. PRCONF.EXE, 19
  2945. Prime Number Generator, 13
  2946. Print, 24
  2947. Print screen, 33
  2948. Printer toggle, 33
  2949. Programming In PROLOG, 5, 12
  2950. Prolog Runtime Systems, 10
  2951. PROLOG Systems, 5
  2952. Prolog Tutorial, 36
  2953. PROLOG
  2954.   Versions, 5
  2955. Prtscr, 31
  2956. Public Domain PROLOG, 5
  2957. Put, 24
  2958.  
  2959. Ramdisk, 12
  2960. Ratom, 27
  2961. Read, 25
  2962. Reclaim the storage, 27
  2963. Reconsult, 17
  2964. Reference, 49
  2965. Returns, 11
  2966. Running the Interpreter, 16
  2967.  
  2968. Short of memory, 12
  2969. Sieve, 13
  2970. Special Offer, 14
  2971. Springer Verlag, 12
  2972. Succees popping, 34
  2973.  
  2974. Technical Information, 11
  2975. The Built In Predicate Library, 20
  2976. The Interrupt Menu, 32
  2977. Trace file, 33
  2978. Trace toggle, 33
  2979.  
  2980. Upgrade Policy, 11
  2981.  
  2982. VMA PROLOG Large model Virtual Memory System, 9
  2983. VMI PROLOG, 6
  2984. VML PROLOG, 7
  2985.  
  2986. Write, 24
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.